import 'package:flutter/material.dart';
import 'package:flutter_app/ui/animation1.dart';
import 'package:flutter_app/ui/back_test.dart';
import 'package:flutter_app/ui/jg_count_test.dart';
import 'package:flutter_app/ui/jg_push_test.dart';
import 'package:flutter_app/ui/native_connect.dart';
import 'package:flutter_app/ui/page_two.dart';
import 'package:flutter_app/ui/params_test.dart';
import 'package:flutter_app/ui/share_page.dart';
import 'package:flutter_app/ui/version_flutter.dart';

import 'router_utils.dart';

class UnitRouter {
  static final UnitRouter _routerSingleton = UnitRouter._internal();

   static const String page2 = 'page2';
   static const String animation1 = 'animation1';
   static const String sharePage = 'sharePage';
   static const String refreshDart = 'refreshDart';
   static const String paramsTest = 'paramsTest';
   static const String jgPushTest = 'JgPushTest';
   static const String jgCountTest = 'JgCountTest';
   static const String versionFlutter = 'VersionFlutter';
   static const String nativeConnect = 'NativeConnect';
   static const String backTest = 'BackTest';

   UnitRouter._internal();

   static UnitRouter getInstance()=> _routerSingleton;
   Route<dynamic> generateRoute(RouteSettings settings) {
     switch (settings.name) {
      //TODO 页面跳转拦截功能未设计(用于控制未登录时可以访问的页面)
      case page2:return Left2RightRouter(settings: settings,child: const PageTwo());
      case animation1:return Left2RightRouter(settings: settings,child: const Animation1());
      case sharePage:return Left2RightRouter(settings: settings,child: const SharePage());
      case paramsTest:return Left2RightRouter(settings: settings,child: const ParamsTest());
      case jgPushTest:return Left2RightRouter(settings: settings,child: const JgPushTest());
      case jgCountTest:return Left2RightRouter(settings: settings,child: const JgCountTest());
      case versionFlutter:return Left2RightRouter(settings: settings,child: const VersionFlutter());
      case nativeConnect:return Left2RightRouter(settings: settings,child: const NativeConnect());
      case backTest:return Left2RightRouter(settings: settings,child: const BackTest());
      default:
        return MaterialPageRoute(
            builder: (_) => Scaffold(
                  body: Center(
                    child: Text('No route defined for ${settings.name}'),
                  ),
                ));
    }
  }
}
